const express = require('express');
const router = express.Router();
const db = require('../db/index')
// http://127.0.0.1:3006/home/slideshow
router.get('/slideshow', (req, res) => {
    //查询出首页轮播图
    const sql = 'select * from slideimg';
    db.query(sql, (err, result) => {
        if (err) return res.send({
            status: 301,
            message: err
        })
        res.send({
            status: 200,
            data: result
        });
    })

})
router.get('/hotshop', (req, res) => {
    //获取首页商品
    const sql = 'select * from hotshop';
    db.query(sql, (err, result) => {
        if (err) return res.send({
            status: 301,
            message: err
        })
        res.send({
            status: 200,
            data: result
        });
    })

})

module.exports = router;